package densetsu.model;

import java.util.ArrayList;
import java.util.List;
import java.util.Observable;

import densetsu.model.map.GameMap;
import densetsu.model.map.GridMap;
import densetsu.model.players.HumanPlayer;
import densetsu.model.players.Player;

/**
 * Implementation of the Model interface. Will represent our game model.
 * 
 * @author Koen
 * 
 */
public class GameModel extends Observable implements Model {

	private Player player;
	private ArrayList< Player > enemies;
	private GridMap gameMap;

	public GameModel ( ) {
		this.player = new HumanPlayer ( GameMap.SIZE / 2, GameMap.SIZE / 2 );
		// create enemies and map
		enemies = new ArrayList<> ( );
		gameMap = new GameMap ( );
	}

	@Override
	public GridMap getMap ( ) {
		return gameMap;
	}

	@Override
	public Player getPlayer ( ) {
		return this.player;
	}

	@Override
	public void movePlayer ( Direction d ) {
		player.move ( d );
		setChanged ( );
		notifyObservers ( );
	}

	@Override
	public void moveEnemy ( Player p, Direction d ) {
		p.move ( d );
	}

	@Override
	public List< Player > getEnemies ( ) {
		return this.enemies;
	}

}
